<template>
  <h1>正在登录中...</h1>
</template>

<script>
export default {
  /* watch: {
    // watch不支持[], 只支持.
    // ['$store.getters["loginurl/statue"]']
  } */
  created() {
    // this.unwatch = this.$watch(
    this.unwatch = this.$store.watch(
      () => this.$store.getters["loginUrl/statue"],
      (newVal, oldVal) => {
        console.log(this.$route.query.returnUrl, newVal);
        if (newVal !== "loading") {
          console.log(this.$route.query.returnUrl);
          this.$router.push(this.$route.query.returnUrl ?? "/").catch(() => {});
        }
      },
      { immediate: true }
    );
  },
  destroyed() {
    this.unwatch();
  },
};
</script>

<style></style>
